//模拟实现stack类和queue类，并完成测试
#include<iostream>
#include<deque>
using namespace std;
namespace bit
{
    template<class T, class Con = deque<T>>
    class stack
    {
    public:
        stack()
        {

        }
        void push(const T& x)
        {
            _c.push_back(x);
        }

        void pop()
        {
            _c.pop_back();
        }

        T& top()
        {
            return _c.back();
        }

        const T& top()const
        {
            return _c.back();
        }

        size_t size()const
        {
            return _c.size();
        }

        bool empty()const
        {
           return  _c.empty();
        }

    private:

        Con _c;

    };



    template<class T, class Con = deque<T>>

    class queue

    {

    public:

        queue()
        {

        }

        void push(const T& x)
        {
            _c.push_back(x);
        }

        void pop()
        {
            _c.pop_front();
        }

        T& back()
        {
            return _c.back();
        }

        const T& back()const
        {
            return _c.back();
        }

        T& front()
        {
            return _c.front();
        }

        const T& front()const
        {
           return  _c.front();
        }

        size_t size()const
        {
           return _c.size();
        }

        bool empty()const
        {
            return _c.empty();
        }

    private:

        Con _c;

    };

};
int main()
{
    //bit::stack<int>arr1;
    bit::queue<int>arr1;
    arr1.push(1);
    arr1.push(2);
    arr1.push(3);
    arr1.push(4);
    arr1.push(5);

  /*  cout << arr1.top() << endl;
    while (arr1.size())
    {
        cout << arr1.top() << endl;
        arr1.pop();
    }*/
   /* cout << arr1.front() << endl;
    while (arr1.size())
    {
        cout << arr1.front() << endl;
        arr1.pop();
    }*/
    cout << arr1.back() << endl;
    while (arr1.size())
    {
        cout << arr1.back() << endl;
        arr1.pop();
    }
    return 0;
}